<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<html>
<head>
    <script type="text/javascript">
        function doSearch() {
        	grid.load({
                service_no : $('#service_no').val(),
                service_name : $('#service_name').val(),
                service_st : $('#service_st').val(),
                service_type : $('#service_type').val()
            });
        }

        function addService(url){
            commonDetail(url,"save","serviceTableId");
        }
        function modifyService(url){
            commonDetail(url,"update","serviceTableId");
        }
        function startService(url) {
        	asyncOper(url, "确定要启用这些业务吗");
        }
        function freezeService(url) {
        	asyncOper(url, "确定要停用这些业务吗");
        }
		var grid;
        $(document).ready(function() {
        	grid = $("#serviceTableId").jpgrid({
                url: "getServiceInfListJson.do",
                columns: [
                    {title: "业务编号", field: "SERVICE_NO",width:120},
                    {title: "业务名称", field: "SERVICE_NAME",width:120},
                    {title: "业务类型", field: "SERVICE_TYPE",width:100},
                    {title: "营业开始日期", field: "BEGDATE",formatter:function(val) {
                            if(val != null && val != ""){
                                return val.substring(0,4)+'-'+val.substring(4,6)+'-'+val.substring(6);
                            }
                        }
                    },
                    {title: "营业结束日期", field: "ENDDATE",formatter:function(val) {
                            if(val != null && val != ""){
                                return val.substring(0,4)+'-'+val.substring(4,6)+'-'+val.substring(6);
                            }
                        }
                    },
                    {title: "每天营业开始时间", field: "BEGTIME",formatter:function(val) {
                            if(val != null && val != "") {
                                return val.substring(0, 2) + ':' + val.substring(2, 4) + ':' + val.substring(4);
                            }
                        }
                    },
                    {title: "每天营业结束时间", field: "ENDTIME",formatter:function(val) {
                            if(val != null && val != "") {
                                return val.substring(0, 2) + ':' + val.substring(2, 4) + ':' + val.substring(4);
                            }
                        }
                    },
                    {title: "业务状态", field: "SERVICE_ST"}
                ]
            });
        });
        function asyncOper(url, msg){
    		commonAsync(url, "serviceTableId", msg, function(result){
    			grid.reload();
    		});
    	}
    </script>
</head>
<body class="easyui-layout list_body">
<form id="serviceForm" name="serviceForm" >
	<div class="list_body_north" data-options="region:'north'" border="false">
	    <!-- 查询表单 -->
	    <div class="datagrid-toolbar" border="false">
            <span>业务编号:</span>
            <input id="service_no" type="text" name="service_no"  class="easyui-textbox">
            <span>业务名称:</span>
            <input id="service_name" type="text" name="service_name"  class="easyui-textbox">
            <span>业务状态:</span>
            <code:codeSelect id="service_st" name="service_st" code_type="service_st" showSelect="true" selectId="${serviceInfEntity.service_st}"></code:codeSelect>
            <span>业务类型:</span>
            <code:codeSelect id="service_type" name="service_type" code_type="service_type" showSelect="true" selectId="${serviceInfEntity.service_type}"></code:codeSelect>
            <a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch() ">查询</a>
            <a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm() ">重置</a>
	    </div>
	    <!-- 自定义标签工具栏 -->
	    <jiepos:buttonOperateTag menuCode="${menuCode}"></jiepos:buttonOperateTag>
    </div>
	<div data-options="region:'center'" border="false" class="list_body_center">
	    <!-- 表格 -->
	    <table id="serviceTableId" fit="true"></table>
    </div>
</form>
</body>
</html>
